
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2580. -- [Usaco2012 Jan]Video Game  -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2580: [Usaco2012 Jan]Video Game </h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>128 MB<br><span class=green>Submit: </span>14&nbsp;&nbsp;<span class=green>Solved: </span>11<br>[<a href='submitpage.php?id=2580'>Submit</a>][<a href='problemstatus.php?id=2580'>Status</a>][<a href='bbs.php?id=2580'>Discuss</a>]</center><h2>Description</h2><div class=content><div class="problem-text" align="left"><span style="font-size: medium; "><span class="mono prewrap" id="probtext-text">Bessie is playing a video game! In the game, the three letters 'A', 'B', and 'C' are the only valid buttons. Bessie may press the buttons in any order she likes; however, there are only N distinct combos possible (1 &lt;= N &lt;= 20). Combo i is represented as a string S_i which has a length between 1 and 15 and contains only the letters 'A', 'B', and 'C'. Whenever Bessie presses a combination of letters that matches with a combo, she gets one point for the combo. Combos may overlap with each other or even finish at the same time! For example if N = 3 and the three possible combos are &quot;ABA&quot;, &quot;CB&quot;, and &quot;ABACB&quot;, and Bessie presses &quot;ABACB&quot;, she will end with 3 points. Bessie may score points for a single combo more than once. Bessie of course wants to earn points as quickly as possible. If she presses exactly K buttons (1 &lt;= K &lt;= 1,000), what is the maximum number of points she can earn?&nbsp;</span></span></div>
<div class="problem-text" align="left"><span style="font-size: medium; "><br type="_moz" />
</span></div>
<div class="problem-text" align="left"><span style="font-size: medium; "><span class="Apple-style-span" style="font-family: simsun; color: rgb(70, 70, 70); line-height: 21px; ">给出n个ABC串combo[1..n]和k，现要求生成一个长k的字符串S，问S与word[1..n]的最大匹配数</span></span></div></div><h2>Input</h2><div class=content><p><font size="4">&nbsp;Line 1: Two space-separated integers: N and K. * Lines 2..N+1: Line i+1 contains only the string S_i, representing combo i.</font></p>
<p><font size="4">&nbsp;</font></p></div><h2>Output</h2><div class=content><p><span style="font-size: medium">Line 1: A single integer, the maximum number of points Bessie can obtain.<br />
</span></p></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata> 3 7 ABA CB ABACB </span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata> <br />
  4 </span></div><h2>HINT</h2>
			<div class=content><p><p>&nbsp;The optimal sequence of buttons in this case is ABACBCB, which gives 4 points--1 from ABA, 1 from ABACB, and 2 from CB.</p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search='></a></p></div><center>[<a href='submitpage.php?id=2580'>Submit</a>][<a href='problemstatus.php?id=2580'>Status</a>][<a href='bbs.php?id=2580'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
